#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>

int main()
{
    int fd = 0;
    int num = 99;

    fd = open("/dev/hzfchar", O_RDWR, S_IRUSR|S_IWUSR);

    if(fd != -1)
    {
        read(fd, &num, sizeof(int));
        printf("the first value is %d\n", num);

        num = 1111;
        write(fd, &num, sizeof(int));

        read(fd, &num, sizeof(int));
        printf("the secondary value is %d\n", num);

        close(fd);
    }
    else
    {
        printf("fail,the first value is %d;err=%s\n", num, strerror(errno));
    }
}
